package com.wcy.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wcy.entity.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 吴传亿
 * @since 2025-04-29
 */
public interface RoleMapper extends BaseMapper<Role> {
    @Results({
            @Result(property = "roleId", column = "role_id"),
            @Result(property = "permissions", column = "role_id",many = @Many(select = "com.wcy.mapper.PermissionMapper.selectPermissionByRoleId")),
    })
    @Select("<script>select * from role <where> ${ew.sqlSegment}</where></script>")
    Page<Role> selectPage(Page<Role> page, @Param("ew") Wrapper<Role> wrapper);
}

